#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 7;
int n, a[N], odd[N], even[N], check[N];

int main()
{
	cin >> n;
	int cntodd = 0, cntEven = 0;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		if (a[i] % 2) // 偶数
			check[i] = 1, odd[++cntodd] = a[i];
		else
			check[i] = 0, even[++cntEven] = a[i];
	}
	sort(odd + 1, odd + 1 + cntodd);
	sort(even + 1, even + 1 + cntEven);
	cntodd = 0, cntEven = 0;
	for (int i = 1; i <= n; i++)
	{
		if (check[i])
			cout << odd[++cntodd] << " ";
		else
			cout << even[++cntEven] << " ";
	}

	return 0;
}